/*
 * Copyright (c) gitee.com/jiandong001.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import { WritableNativeMap } from '../bridge/ReadableNativeMap';
import { JavaScriptExecutorFactory } from '../bridge/JavaScriptExecutorFactory'
import { JavaScriptExecutor } from '../bridge/JavaScriptExecutor'
import { JSCExecutor } from './JSCExecutor'


export class JSCExecutorFactory implements JavaScriptExecutorFactory {

  public constructor(private mAppName: string, private mDeviceName: string) { }

  public create(): JavaScriptExecutor| never {
    let jscConfig: WritableNativeMap =  {
      "OwnerIdentity": "ReactNative",
      "AppIdentity": this.mAppName,
      "DeviceIdentity": this.mDeviceName,
    }
    return new JSCExecutor(jscConfig);
  }

  public startSamplingProfiler() {
    throw new Error("Starting sampling profiler not supported on " + this.toString());
  }

  public stopSamplingProfiler(filename: string) {
    throw new Error("Stopping sampling profiler not supported on " + this.toString());
  }

  public toString(): string {
    return "JSIExecutor+JSCRuntime";
  }
}
